package com.alwaysdata.esm3.trait_sep.modele;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Injection {
	
	protected Date dateInj;
	protected String zoneInj;
	protected int siteInj;
	protected String commentaireInj;

	// Getters
	public Date getDateInj() {
		return dateInj;
	}
	public String getZoneInj() {
		return zoneInj;
	}
	public int getSiteInj() {
		return siteInj;
	}
	public String getCommentaireInj() {
		return commentaireInj;
	}

	//Constructeurs
	public Injection(Date pDateInj, String pZoneInj, int pSiteInj, String pCommentaireInj){
		
		if ((pDateInj.compareTo(new Date()) <= 0)){
			this.dateInj        = pDateInj;
		} else {
			System.out.println("Impossible");
		}
		
		this.zoneInj        = pZoneInj;
		this.siteInj        = pSiteInj;
		this.commentaireInj = pCommentaireInj;
	}
	
	@Override
	public String toString(){
		SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
		StringBuilder sb = new StringBuilder("\n-");
		sb.append(sdf.format(dateInj)).append("\n- ");
		sb.append(zoneInj).append("\n- ");
		sb.append(siteInj).append("\n- ");
		sb.append(commentaireInj).append("\n");
		
		
		return sb.toString();
	}
	
}
